import java.util.Scanner;

public class Demo2 {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        while (n > 0) {
            n--;
            long a1 = scanner.nextLong();//迪迦攻击
            long d1 = scanner.nextLong();//迪迦防御
            long a2 = scanner.nextLong();//赛文攻击
            long d2= scanner.nextLong();//赛文防御
            long A = scanner.nextLong();//攻击和
            long D = scanner.nextLong();//防御和
            long x = 0;//迪迦个数
            long y = 0;//赛文个数
            if (a1 * d2 - a2 * d1 < 0) {
                System.out.println(-1);
                continue;
            }
            y = (D * a1 - A * d1) / (a1 * d2 - a2 * d1);
            x = (A - y * a2) / a1;
            if (y < 0 || x < 0) {
                System.out.println(-1);
                continue;
            }
            System.out.println(x + " " + y);
        }
    }
}
